#include <butil/logging.h>
#include <brpc/channel.h>
#include "cal.pb.h" 

int main(int argc, char* argv[])
{
    brpc::ChannelOptions options;
    options.protocol = brpc::PROTOCOL_HTTP;

    brpc::Channel channel;

    channel.Init("192.168.56.129:9000", &options);

    brpc::Controller cntl;
    cntl.http_request().set_method(brpc::HTTP_METHOD_POST);
    cntl.http_request().uri().set_path("/CalService/Hello"); // 设置请求资源路径
    cntl.http_request().SetHeader("Content-Type", "text/plain");
    cntl.request_attachment().append("Hello World");
    channel.CallMethod(nullptr, &cntl, nullptr, nullptr, nullptr);

    if(cntl.Failed() == false)
    {
        std::cout << cntl.response_attachment().to_string() << std::endl;
    }
    else
    {
        std::cout << cntl.ErrorText() << std::endl;
    }
    return 0;
}